#define _CRT_SECURE_NO_WARNINGS 1
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
ll n, cnt = 1;
ll a[2010][2010], b[4000010];

void solve() {
	cin >> n;
	cout << b[n] << endl;
}

int main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int t; cin >> t;
	for (int i = 1; i <= 2000; i++) {
		for (int j = 1; j <= i; j++) {
			if (i == 1) a[i][j] = 1;
			else {
				a[i][j] = cnt * cnt + a[i - 1][j - 1] + a[i - 1][j] - a[i - 2][j - 1];
			}
			b[cnt] = a[i][j];
			cnt++;
		}
	}
	while (t--) {
		solve();
	}
	return 0;
}